package vm;

/**
 * @author zzb
 * @since 2021-01-19
 */
public class JavaVMStackSOF {
  private int stackLength = 1;
  public void stackLeak() {
    stackLength++;
    stackLeak();
  }

  public static void main(String[] args) {
    JavaVMStackSOF oom = new JavaVMStackSOF();
    try {
      oom.stackLeak();
    } catch (Throwable e) {
      System.out.println("stack length" + oom.stackLength);
      throw e;
    }
  }
}
/**
 * stack length1542
 * Exception in thread "main" java.lang.StackOverflowError
 * 	at vm.JavaVMStackSOF.stackLeak(JavaVMStackSOF.java:12)
 * 	at vm.JavaVMStackSOF.stackLeak(JavaVMStackSOF.java:13)
 * 	at vm.JavaVMStackSOF.stackLeak(JavaVMStackSOF.java:13)
 * 	以下省略
 */
